<?php

class Disciplina extends Controller {

	function __construct(){
		parent::Controller();
		$this->load->library('session');	
	}
	
	function cadastrar(){	
  	$this->load->helper('form');
	$this->load->model('Disciplina_model', 'disciplina_model');
	
  	$campos = $this->disciplina_model->campos;
  		
  	$data['formulario']= "";

	foreach($campos as $campo){
    	switch($campo['type']){		
      	case 'select':      
        	$selecionado=$this->input->post($campo['name'],$campo['selected']);  
          $data['formulario'] .= form_label("<span>".$campo['title']."</span> ". form_dropdown($campo['name'], $campo['options'], $selecionado),$campo['name'],array('class'=>$campo['class']));
          break;
          
      	case "password":    		
      	case "text":
          $data['formulario'] .= form_label("<span>".$campo['title']."</span> ".form_input($campo,$this->input->post($campo['name'])), $campo['name'], array('class'=>$campo['class']));
          break;
    	}
  	}
	$data['aviso']= "";
    $this->load->view('disciplina/cadastrar', $data);

}	
}